package Pages;

import javax.microedition.lcdui.Graphics;

import Core.Event;
import Core.Slide;
import Element.Listbox;
import Server.ISocket;

public class Test extends Slide {
	ISocket socket = new ISocket();
	Listbox lst = new Listbox(50, 50, 150, 200, new Event() {
		public void action() {
			System.out.println("Click vao " + lst.iIndex);
		}
	});
	public void init(){
		//socket.connect("203.162.70.143", 6700);
		for(int  i = 0; i < 10; i++)
			lst.addItem(lst.new ItemList(50,"Item " + i));
	}
	public void destroy(){
		lst.destroy();
	}
	
	public void Click(int ID, int x, int y) {
		//System.out.println("Send ->");
		//SendPack.onLogin("ah1234", "1234");
		lst.Click(x, y);
	}
	
	public void update(){
		lst.update();
	}
	public void paint(Graphics g){
		clear(g, 0xFFCCAA);
		lst.paint(g);
		//RGBFont.fnormal.drawString(g, "KEY="+socket.Key, 10, 10, 0, 0);
	}
	public void onkeyDown(int keyCode) {
		lst.onkeyDown(keyCode);
	}
	public void touchDown(int ID, int x, int y) {
		lst.touchDown(x, y);
	}
	public void touchUp(int ID, int x, int y, int dragTime, int xBegin,	int yBegin) {
		lst.touchUp(x, y, dragTime, xBegin, yBegin);
	}
	public void touchDrag(int x, int y) {
		lst.touchDrag(x, y);
	}
}
